from django.db import models


class userInfo(models.Model):
    user_type_choices = {
        (1, '普通用户'),
        (2, 'VIP'),
        (3, 'SVIP'),
    }
    user_type = models.IntegerField(choices=user_type_choices, default=2)
    username = models.CharField(max_length=32, unique=True)
    password = models.CharField(max_length=64)


class userToken(models.Model):
    user = models.OneToOneField(to='userInfo', on_delete=models.CASCADE)
    token = models.CharField(max_length=64)


class action(models.Model):
    id = models.CharField(max_length=64, primary_key=True)
    user = models.ForeignKey(userInfo, on_delete=models.CASCADE)
    handlerName = models.CharField(max_length=64)
    data_source_id = models.CharField(max_length=64)
    tableName = models.CharField(max_length=64)
    attributeNameList = models.CharField(max_length=256)
    method = models.CharField(max_length=64)
    parameters = models.CharField(max_length=256)

